package tools;

public class HexDemo {

	public static void main(String[] args) {
//demo 1
//		final String lineSeparator = System.getProperty("line.separator");
//		for (int i = 0x0000; i <= 0xffff; i++) {
//			if (i % 0x10 == 0) {
//				System.out.println(lineSeparator);
//			} else {
//				System.out.write('\t');
//			}
//
//			System.out.print((char) i);
//		}
//demo2
		new HexDemo().print();
	}

	public void print() {
		System.out.print("       0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F");

		System.out.println();
		for (int i = 0; i <= 12047; System.out.println()) {
			String s = "0000" + new Integer(i).toHexString(i);
			System.out.print(s.substring(s.length() - 5, s.length() - 1));
			System.out.print("   " + (char) i++);
			System.out.print("   " + (char) i++);
			System.out.print("   " + (char) i++);
			System.out.print("   " + (char) i++);
			System.out.print("   " + (char) i++);
			System.out.print("   " + (char) i++);
			System.out.print("   " + (char) i++);
			System.out.print("   " + (char) i++);
			System.out.print("   " + (char) i++);
			System.out.print("   " + (char) i++);
			System.out.print("   " + (char) i++);
			System.out.print("   " + (char) i++);
			System.out.print("   " + (char) i++);
			System.out.print("   " + (char) i++);
			System.out.print("   " + (char) i++);
			System.out.print("   " + (char) i++);
		}
	}
}
